<%@ page pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/base/taglibs.jsp"%>

<html>
	<head>
		<link href="${ctx}/css/main.css" rel="stylesheet" type="text/css" />
	</head>
	
	<script language="javascript">
		var message = '${message}';
		if(message != ''){
			alert(message);
		}
		
		function submitAction(action){
			if(document.getElementById('linkAddress').value == ''){
				alert('请输入链接地址');
				return false;
			}
			if(document.getElementById('content').value == ''){
				alert('请输入内容提示');
				return false;
			}
			document.linkForm.action = action ;
			document.linkForm.submit();
		}
		
		function init(){
			document.getElementById("linkAddress").value = "";
			document.getElementById("content").value = "";
			document.getElementById("memo").value ="";
		}
		
		function doDelete(action,linkAddress){
			if(confirm('是否确认删除？')){
				location.href = "${ctx}/" + action + "?linkAddress=" + linkAddress;
			}
		}
	</script>
	
	<body>
		<form method="post" action="" name="linkForm">
			<table border="0" cellspacing="1" cellpadding="3" align="center" width="100%">
				<tr>
					<td width="20%" class="td2"> 
						链接地址 <span style="color:red;vertical-align:middle;">*</span> 
					</td>
					<td width="30%" class="td2">
						<input type="text" name="linkAddress" size="32" value="${friendlyLink.linkAddress}">
					</td>
					<td width="20%" class="td2">
						内容提示 <span style="color:red;vertical-align:middle;">*</span> 
					</td>
					<td width="30%" class="td2">
						<input type="text" name="content" size="32" value="${friendlyLink.content}">
					</td>
				</tr>
				<tr>
					<td width="20%" class="td2"> 
						详细描述
					</td>
					<td width="80%" class="td2" colspan="3">
						<input type="text" name="memo" size="99" value="${friendlyLink.memo}">
					</td>
				</tr>
				<tr>
					<td class="td11" align="left" colspan="4">
						<input type="button" name="new" value="保存" onClick="submitAction('linkSave.ac');">
						&nbsp;&nbsp;<input type="button" name="reset" value="重置" onClick="init()">
					</td>
				</tr>
			</table>
			<BR>
			<table border="0" cellspacing="1" cellpadding="3" align="center" width="100%">
				<tr>
					<td width="30%" class="td1" align="center">
						链接地址
					</td>
					<td width="20%" class="td1" align="center">
						内容提示
					</td>
					<td width="40%" class="td1" align="center">
						描述
					</td>
					<td width="10%" class="td1" align="center">
						删除
					</td>
				</tr>
				<c:forEach var="link" items="${linkList}">
					<tr>
						<td class="td2">
							${link.linkAddress}
						</td>
						<td class="td2">
							${link.content}
						</td>
						<td class="td2">
							${link.memo}
						</td>
						<td class="td2">
							<img src="${ctx}/images/delete0.png" onclick="javascript:doDelete('deleteLink.ac','${link.linkAddress}');">
						</td>
					</tr>
				</c:forEach>
			</table>
		</form>
	</body>
	
	
		
</html>